#include <QtGui>
#include <QtCore/QTextCodec>
#include <QTranslator>
#include "gv_systemhomedialog.h"
#include "gv_systemcomconfigurationdialog.h"
#include "gv_systemselectiondialog.h"
#include "gv_systemtransmittershomedialog.h"
#include "gv_systemselectiondialog.h"
#include "gv_home.h"
#include "gv_systemIOPanelhomedialog.h" //jlh add for iopanel 100807
#include "gv_setting.h"

extern GV_Setting *gvsetting;
extern QDialog  *dialog;
GV_SystemHomeDialog::GV_SystemHomeDialog(QWidget *parent)
       : QDialog(parent)
{
    setupUi(this);

    QTranslator translator;
    translator.load(gvsetting->GV_GetLanguage(),".");
    qApp->installTranslator(&translator);
    reloadtext();

    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
    timer = new QTimer;
    connect(timer,SIGNAL(timeout()),this,SLOT(GV_chTime()));
    connect(BackButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(CancelButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(ConfigurationButton,SIGNAL(clicked()),this,SLOT(configuration()));
    connect(TransmittersButton,SIGNAL(clicked()),this,SLOT(transmitters()));
    connect(IOPanelsButton,SIGNAL(clicked()),this,SLOT(iopanel()));
    timer->start(1000);
}
void GV_SystemHomeDialog::reloadtext()
{
    //NameHintsLabel->setText(tr("Zones"));
}
void GV_SystemHomeDialog::GV_chTime()
{
    TimeHintsLabel->setText((QDateTime::currentDateTime().toString("hh:mm:ss")));
    DateHintsLabel->setText((QDateTime::currentDateTime().toString("yyyy-MM-dd")));
}

void GV_SystemHomeDialog::home()
{
    QDialog *dialog1 = new gv_home;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
void GV_SystemHomeDialog::configuration()
{
    QDialog *dialog1 = new GV_SystemSelectionDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
void GV_SystemHomeDialog::transmitters()
{
    QDialog *dialog1 = new GV_SystemTransmittersHomeDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
void GV_SystemHomeDialog::iopanel()
{
    //jlh add for IOPanel 100807
    QDialog *dialog1 = new GV_SystemIOPanelHomeDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}
